package 并查集;

public class Main {
	public static void main(String[] args) {
		UnionFind1 uf = new UnionFind1(10);
		uf.union(0, 1);
		uf.union(0, 2);
		uf.union(1, 3);
		uf.union(1, 4);
		
		uf.union(5, 6);
		
		uf.union(7, 8);
		uf.union(8, 9);
		
		System.out.println(uf.isSame(0, 5) == false);
		uf.union(0, 6);
		System.out.println(uf.isSame(0, 5) == true);
		System.out.println(uf.isSame(5, 8) == false);
		uf.union(5, 9);
		System.out.println(uf.isSame(5, 8) == true);
		System.out.println(uf.find(9));
		
		/*Student s1 = new Student("A", 18);
		Student s2 = new Student("B", 20);
		Student s3 = new Student("C", 16);
		Student s4 = new Student("D", 19);
		
		GenericUnionFind<Student> uf = new GenericUnionFind<>();
		uf.makeSet(s1);
		uf.makeSet(s2);
		uf.makeSet(s3);
		uf.makeSet(s4);
		
		
		System.out.println(uf.isSame(s1, s2));
		uf.union(s1, s2);
		System.out.println(uf.isSame(s1, s2));
		System.out.println(uf.isSame(s1, s4));
		uf.union(s4, s2);
		System.out.println(uf.isSame(s1, s4));
		System.out.println(uf.find(s1));*/
		
	}
}
